package woaini.wind.bot.rasa.action;

import cn.hutool.core.collection.CollUtil;
import woaini.wind.bot.rasa.base.Action;
import woaini.wind.bot.rasa.base.CollectingDispatcher;
import woaini.wind.bot.rasa.base.domain.Domain;
import woaini.wind.bot.rasa.base.event.ActionExecuted;
import woaini.wind.bot.rasa.base.event.Event;
import woaini.wind.bot.rasa.base.event.SessionStarted;
import woaini.wind.bot.rasa.base.message.Message;
import woaini.wind.bot.rasa.base.tracker.Tracker;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 开始新对话时候触发的
 *
 * @see SessionStartAction
 * @author yefeng {@date 2024-10-29 17:49:09}
 */
@Component
@Slf4j
public class SessionStartAction implements Action {
  @Override
  public String name() {
    return "action_session_start";
  }

  @Override
  public List<? extends Event> run(
      CollectingDispatcher dispatcher, Tracker tracker, Domain domain) {

    ActionExecuted actionExecuted = ActionExecuted.builder("action_listen").build();
    return CollUtil.newArrayList(new SessionStarted(),actionExecuted);
  }
}
